import Login from '@/views/Login/InDex.vue'
import Layout from '@/views/Layout/InDex.vue'
import { createRouter, createWebHistory } from "vue-router";
import UserOrder from '@/views/Member/components/UserOrder.vue'
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            component: Layout,
            children: [
                {
                    path: '',
                    component: () => import('@/views/Home/InDex.vue')
                },
                {
                    path: 'category/:id',
                    component: () => import('@/views/Category/InDex.vue')
                },
                {
                    path: 'category/sub/:id',
                    component: () => import('@/views/SubCategory/InDex.vue')
                },
                {
                    path: 'detail/:id',
                    component: () => import('@/views/Detail/InDex.vue')
                },
                {
                    path: 'cartlist',
                    component: () => import('@/views/CartList/InDex.vue')
                },
                {
                    path: 'checkout',
                    component: () => import('@/views/CheckOut/InDex.vue')
                },
                {
                    path: 'pay',
                    component: () => import('@/views/Pay/InDex.vue')
                },
                {
                    path: 'paycallback',
                    component: () => import('@/views/Pay/components/PayBack.vue')
                },
                {
                    path: '/member',
                    component: () => import('@/views/Member/InDex.vue'),
                    children: [
                        {
                            path: '',
                            component: () => import('@/views/Member/components/UserInfo.vue')
                        },
                        {
                            path: 'order',
                            component: UserOrder
                        }
                    ]
                }
            ]
        },
        {
            path: '/login',
            component: Login
        }
    ],
    // 路由滚动行为定制
    scrollBehavior() {
        return {
            top: 0
        }
    }
})
export default router